/**
 * 
 */
package ac.svn.accesscontrol.ui;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author Ankush
 *
 */
public class UIComponentLibrary 
{
	private static UIComponentLibrary componentLibrary;
	private Map<String, Object> componentMap;
	private UIComponentLibrary()
	{
		this.componentMap = new HashMap<String, Object>();
	}
	private static UIComponentLibrary getComponentLibrary() {
		if(null ==  componentLibrary)
		{
			componentLibrary = new UIComponentLibrary();
		}
		return componentLibrary;
	}
	
	public static Object getComponent(String componentId)
	{
		return getComponentLibrary().componentMap.get(componentId);
	}
	
	public static void removeComponent(String componentId)
	{
		 getComponentLibrary().componentMap.remove(componentId);
	}
	
	public static void addComponent(String componentId, Object component)
	{
		getComponentLibrary().componentMap.put(componentId, component);
	}
	
	public static Set<String> getComponentIds()
	{
		return getComponentLibrary().componentMap.keySet();
	}

}
